import 'package:flutter_screenutil/screenutil.dart';
import 'package:flutter/material.dart';
import 'package:heyangkuaidai/DemonStrateModule/Components/TwoLabelItem.dart';
import 'package:heyangkuaidai/DemonStrateModule/Components/LeftLabelInputItem.dart';
import 'package:heyangkuaidai/DemonStrateModule/Components/SmsCodeItem.dart';
import 'package:heyangkuaidai/DemonStrateModule/Components/NavigationBar.dart';
import 'package:keyboard_avoider/keyboard_avoider.dart';
import 'package:heyangkuaidai/DemonStrateModule/LoanApplySuccessPage.dart';
class LoanSendConfirmPage extends StatefulWidget {
  String money;
  String startEndDate;
  LoanSendConfirmPage({this.money,this.startEndDate});
  @override
  _LoanSendConfirmPageState createState() => _LoanSendConfirmPageState();
}

class _LoanSendConfirmPageState extends State<LoanSendConfirmPage> {
  String smscode;
  String password;
  final ScrollController _scrollController = ScrollController();
  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, width: 375, height: 667, allowFontScaling: true);
    String money =widget.money;
    return Scaffold(
      resizeToAvoidBottomInset: false,
      body: Column(
        children: [
          SizedBox(height: MediaQuery.of(context).padding.top,),
          NavigationBar(false,title: "放款确认",),
          Container(
              width: ScreenUtil.screenWidth,
              height: ScreenUtil.screenHeight-MediaQuery.of(context).padding.top-ScreenUtil().setWidth(70),
              child: KeyboardAvoider(
                autoScroll: true,
                  child:ListView(
                     controller: _scrollController,
                     padding: EdgeInsets.only(top: 0),
                     children: [

                      TwoLabelItem(title:"借款金额" ,hitText:"$money元 " ,),
                      TwoLabelItem(title:"借款人姓名", hitText: "章*闯",),
                      TwoLabelItem(title:"身份证号", hitText: "430110********5648",),
                      TwoLabelItem(title:"年利率", hitText: "4.65%",),
                      TwoLabelItem(title:"起止时间 ", hitText: widget.startEndDate,),
                      TwoLabelItem(title:"贷款账号", hitText: "621416********6165646",),
                      TwoLabelItem(title:"还款方式", hitText: "按月付息，到期还本",),
                      TwoLabelItem(title:"还款日", hitText: "每月21日",),
                      SizedBox(height: ScreenUtil().setWidth(10),),
                      smsCodeItem(finishCallback: (text){
                            smscode =text;
                      },),
                      LeftLabelInputItem(title: "交易密码",hitText: "请输入交易密码",finishCallback: (text){
                           password =text;
                      },obscureText: true,),
                  Column(
                    children: [
                      Container(
                        width: ScreenUtil().setWidth(341),
                        // height: ScreenUtil().setWidth(21),
                        child:Center(
                          child: Text("短信验证码已发送至136****9654，请注意查收。",style: TextStyle(fontSize: ScreenUtil().setSp(15),color: Color(0xff666666)),textAlign: TextAlign.left,),
                        ),
                      ),
                      SizedBox(height: ScreenUtil().setWidth(23),),
                      InkWell(
                        onTap: (){
                          if(smscode.isEmpty){
                            return;
                          }
                          if(password.isEmpty){
                            return;
                          }
                          Navigator.push(
                            context,
                            new MaterialPageRoute(
                              builder: (context) => new LoanApplySuccessPage(money: money,),
                            ),
                          );

                        },
                        child: Container(
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(4),
                              color:Color(0xff41A5EE),
                            ),
                            width: ScreenUtil().setWidth(347),
                            height: ScreenUtil().setWidth(44),
                            child:Center(
                              child: Text("确认放款",style: TextStyle(fontSize: ScreenUtil().setSp(17),color: Colors.white),textAlign: TextAlign.center,),
                            )
                        ) ,
                      )
                    ],
                  )
                ],
              )
            )
          ),
          
        ],
      ),
    );
  }
}
